﻿using System;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Xml;
using System.Collections.Generic;

namespace Syfuhs.APIWrappers.LiveMeeting
{
    public class LiveMeetingConferenceCenter : ParsedType
    {
        public bool EmailRequired { get; set; }

        public bool GroupIDStartsWithStar { get; set; }

        public bool GroupsCanHoldGroups { get; set; }

        public CultureInfo Locale { get; set; }

        public double MaxInactiveInterval { get; set; }

        public double MaxUsers { get; set; }

        public string ReservedUserID { get; set; }

        public string TimeZone { get; set; }

        public double MaxUsersPerMeeting { get; set; }

        public List<CultureInfo> Locales { get; set; }

        public bool PrintPDFPrivilege { get; set; }

        public PrintingOption PrintPDFPreferenceUserDefault { get; set; }

        public ApplicationSharingOption ApplicationSharingPrivilege { get; set; }

        public ApplicationSharingOption ApplicationSharingPreferenceUserDefault { get; set; }

        public bool RecordingEnabled { get; set; }

        public bool RecordingPreferenceUserDefault { get; set; }

        public bool PublishRealAudio { get; set; }

        public bool PublishNetShowDefault { get; set; }

        public bool PublishNetShowUserDefault { get; set; }

        public bool PublishNetShow { get; set; }

        public bool PublishNonStreamedAudio { get; set; }

        public bool PublishWindowsMediaMovie { get; set; }

        public bool PublishHFF { get; set; }

        public bool PublishHFFUserDefault { get; set; }

        public bool PrintPDFPrivilegeUserDefault { get; set; }

        public bool RecordingPrivilegeUserDefault { get; set; }

        public bool PublishNonStreamedAudioUserDefault { get; set; }

        public bool PublishWindowsMediaMovieUserDefault { get; set; }

        public ApplicationSharingOption ApplicationSharingPrivilegeUserDefault { get; set; }

        public bool EnforceContentDelete { get; set; }

        public bool AllowEnableLobby { get; set; }

        public bool AllowFastLobbyJoin { get; set; }

        public string FastLobbyStaticUsername { get; set; }

        public bool AlowEnableRecording { get; set; }

        public bool AllowRecordingDownload { get; set; }

        public bool AllowEnableAudioBroadcast { get; set; }

        public bool AllowEnableCALLME { get; set; }

        public bool ForceExtendedRegistration { get; set; }

        public bool EcrAnnotationsPrivilegeDefault { get; set; }

        public bool EcrChatPrivilegeDefault { get; set; }

        public bool EcrHandoutsPrivilegeDefault { get; set; }

        public bool EcrQAPrivilegeDefault { get; set; }

        public bool EcrSharednotesPrivilegeDefault { get; set; }

        public bool EcrTextpagePrivilegeDefault { get; set; }

        public bool EcrWhiteboardPrivilegeDefault { get; set; }

        public bool QnALicense { get; set; }

        public bool ElectronicCommPrivacyLicense { get; set; }

        public bool DisableDesktopSharing { get; set; }

        public bool PublishRealAudioUserDefault { get; set; }

        public bool EnableAudioBroadcast { get; set; }

        public double ContentDeleteTimeAmount { get; set; }

        public string ContentDeleteTimeType { get; set; }

        public bool PersonalRecordingEnabled { get; set; }

        public bool CustomFrame { get; set; }

        public bool AllowCustomFrame { get; set; }

        public bool RecordingExpirationEnabled { get; set; }

        public double RecordingExpirationTimeAmount { get; set; }

        public string RecordingExpirationTimeType { get; set; }

        public bool RestorationEnabled { get; set; }

        public bool ComplexMeetingKeys { get; set; }

        public bool ComplexUserKeys { get; set; }

        public bool OnlyMeetingKeysGeneratedByServerAreValid { get; set; }

        public double KeyMinLength { get; set; }

        public bool DigitRequiredInKey { get; set; }

        public bool UcaseRequiredInKey { get; set; }

        public bool LcaseRequiredInKey { get; set; }

        public bool SpecialCharsRequiredInKey { get; set; }

        public bool NamesDisallowedInKey { get; set; }

        public bool StartsAndEndsWithAlphanumeric { get; set; }

        public bool AllowEnableRecording { get; set; }

        public bool AllowEnableAudioVOIP { get; set; }

        public bool EnableAudioVOIP { get; set; }

        public string AdminInviteeTextAudience { get; set; }

        public string AdminInviteeTextPresenter { get; set; }

        public bool AdminInviteeTextAsHeader { get; set; }

        public bool EnableFileTransfer { get; set; }

        public string AllowedFileExtensions { get; set; }

        public string[] AllowedExtensions { get { return AllowedFileExtensions.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); } }

        public double SyncIntervalMeeting { get; set; }

        public double SyncIntervalUser { get; set; }

        public double SyncIntervalCC { get; set; }

        public bool EnableVideo { get; set; }

        public bool AllowVideoEnable { get; set; }

        public bool EcrWebPagePrivilegeDefault { get; set; }
        
        public bool EcrScreenSnapshotPrivilegeDefault { get; set; }
        
        public bool EcrPollPagePrivilegeDefault { get; set; }
        
        public bool EcrUploadSlidesPrivilegeDefault { get; set; }

        public LiveMeetingConferenceCenterProviders Providers { get; set; }
    }

    static class ConferenceCenterResponseParser
    {
        public static LiveMeetingConferenceCenter Parse(XmlDocument response)
        {
            LiveMeetingConferenceCenter center = (LiveMeetingConferenceCenter)
                TypeParser.ParseXmlNodes(new LiveMeetingConferenceCenter(), response.SelectNodes("PlaceWareConfCenter/GetConferencingServiceData7Reply/OptionList"));
            
            center.Providers = LiveMeetingConferenceCenterProviders.ParseProviders(
                response.SelectNodes("PlaceWareConfCenter/GetConferencingServiceData7Reply/ProviderList/Provider"));

            return center;
        }
    }
}
